#include "Vector3.h"
#include <cmath>


Vector3::Vector3() {
	x = 0;
	y = 0;
	z = 0;
}

Vector3::Vector3(double x, double y, double z) : x(x),y(y),z(z)
{
}

Vector3 Vector3::operator +(const Vector3 & v) const
{
        return Vector3(x+v.x, y+v.y, z+v.z);
}

double Vector3::GetX() const
{
    return x;
}

double Vector3::GetY() const
{
    return y;
}

double Vector3::GetZ() const
{
    return z;
}

bool Vector3::operator ==(const Vector3 & v) const
{
        return x==v.x && y==v.y && z==v.z;
}

Vector3 Vector3::operator -(const Vector3 & v) const
{
        return Vector3(x-v.x, y-v.y, z-v.z);
}

Vector3 Vector3::operator ^(const Vector3 & v) const
{
        return Vector3(y*v.z - z*v.y, z*v.x - x * v.z, x*v.y - y*v.x);
}

double Vector3::Length() const
{
        return std::sqrt(x*x+y*y+z*z);
}

Vector3 Vector3::Normalize(double n) const
{
        double len = this->Length()/n;
        return Vector3(x/len,y/len,z/len);
}
